<template>
  <el-dialog title="退款进度查询" :close-on-click-modal="false" :visible.sync="visible" width="80%">
    <div style="overflow-x:scroll; margin-top: 20px;">
      <avue-crud ref="crud" :data="dataList" :table-loading="dataListLoading" :option="tableOption"
        @current-change="handleCurrentChange" @size-change="handleSizeChange">
      </avue-crud>
    </div>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
      :current-page="page.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="page.pageSize"
      layout="total, sizes, prev, pager, next, jumper" :total="page.total">
    </el-pagination>
  </el-dialog>
</template>

<script>
import { tableOption } from '@/crud/refund/checkRefundProgress'
export default {
  name: 'checkRefundProgress',
  data() {
    return {
      visible: false,
      dataList: [],
      dataListLoading: false,
      tableOption: tableOption,
      id: '',
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 10 // 每页显示多少条
      }
    }
  },
  methods: {

    init(data) {
      this.id = data.id
      this.visible = true
      this.checkRefundProgress()
    },

    // 获取数据列表
    checkRefundProgress() {
      console.log("e", this.id)
      this.$http({
        url: this.$http.adornUrl('/v1/merchant/refund/query/detail'),
        method: 'get',
        params: this.$http.adornParams(
          Object.assign(
            {
              id: this.id
            },
          )
        )
      }).then((res) => {
        console.log(res, "res")
        if (res.data.code === 0) {
          this.dataList = res.data.data
        } else {
          this.$message({
            message: res.data.msg,
            type: 'error',
            center: true
          });
        }
      }).catch(err => {
        console.log(err, "err")
      })
    },
    handleCurrentChange(val) {
      this.page.currentPage = val
      this.getDataList(this.page)
    },
    handleSizeChange(val) {
      this.page.pageSize = val
      this.getDataList(this.page)
    }
  }
}
</script>

<style scoped></style>
